import request from '@/utils/request'
const prefix = '/gift/api/address'

/**
 * 获取地址列表
 * @returns
 */
 const getMyList = () => {
	return request({
		url: prefix + '/myList',
	})
}

/**
 * 获取用户默认地址
 * @returns
 */
 const getDefaultAddress = () => {
	return request({
		url: prefix + '/default',
	})
}

/**
 * 新增地址
 * @returns
 */
 const insertAddress = (data) => {
	return request({
		url: prefix + '/add',
		method: 'post',
		data
	})
}
/**
 * 修改地址
 * @returns
 */
 const updateAddress = (data) => {
	return request({
		url: prefix + '/update',
		method: 'put',
		data
	})
}
/**
 * 删除地址
 * @returns
 */
 const delAddress = (id) => {
	return request({
		url: prefix + '/delete/' + id,
		method: 'delete',
	})
}
/**
 * 获取地址详情
 * @returns
 */
 const getAddressDetail = (id) => {
	return request({
		url: prefix + '/info/' + id,
	})
}

export default {
	getAddressDetail,
	delAddress,
	updateAddress,
	insertAddress,
	getMyList,
	getDefaultAddress
}